<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>tab--设计院回复意见</title>
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <meta http-equiv="Expires" content="0">
    <meta http-equiv="Cache-Control" content="no-siteapp,no-transform,no-store, no-cache, must-revalidate">
    <meta http-equiv="Pragma" content="no-cache">
    <link rel="stylesheet" href="/static/css/font.css">
    <link rel="stylesheet" href="/static/css/weadmin.css">
    <script type="text/javascript" src="/lib/layui/layui.js" charset="utf-8"></script>
    <style>
        body {
            -webkit-box-sizing: border-box;
            -moz-box-sizing: border-box;
            box-sizing: border-box;
            padding: 20px;
        }
    </style>
</head>
<body>
<table class="layui-hide" id="dataList" lay-filter="dataList"></table>
<script type="text/html" id="barDemo">
    <a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="detail">回复</a>
</script>
<script type="text/javascript" src="/lib/layui/layui.js"></script>
<script src="/static/js/main.js"></script>
<script>
    var configureCom = {};
    layui.use(['jquery', 'configureCom', 'configure', 'sessionFun', 'table', 'matchDict'], function () {
        var $ = layui.jquery;
        var configure = layui.configure;
        var table = layui.table;
        var sessionFun = layui.sessionFun;
        var matchDict = layui.matchDict;
        configureCom = layui.configureCom;
        var listData = sessionFun.get(configure.SESSION_PROJECT_LIST_DATA);
        var cols = [[
            {type: 'numbers', title: '序号'},
            {field: 'checkTimes', title: '轮数', width: 60},
            {field: 'drawingNum', title: '图号'},
            {
                field: 'articleType', title: '条文性质', templet: function (d) {
                    if (d.articleType == 1) {
                        return '<p>' + matchDict.name(d.articleType, configure.ARTICLE_TYPE) + '</p><p>强条类型:' + matchDict.name(d.qiangtiaoType, configure.QIANGTIAO_CODE) + '</p>'
                    } else {
                        return '<p>' + matchDict.name(d.articleType, configure.ARTICLE_TYPE) + '</p>'

                    }
                }
            },
            {field: 'tiaowenNum', title: '编号及条目'},
            {
                field: 'adviseTxt', title: '审查意见', width: 200, templet: function (d) {
                    return '<p>' + d.adviseTxt + '</p><p>(' + d.expertName + ':' + d.createTime + ')</p>'
                }
            },
            {field: 'replyTxt', title: '设计院回复内容', width: 200},
            {title: '操作', toolbar: '#barDemo'}
        ]];
        configureCom.tableRender(configure.EXPERT_SPECITY_SUGGEST_HTTP, {
            decId: listData.decId,
            specialtyId: listData.specialtyId
        }, cols, 'dataList', 10, '');
        table.on('tool(dataList)', function (obj) {
            var data = obj.data;
            console.log(data);
            sessionFun.set(configure.SESSION_PROJECT_LIST_DATA, data);
            if (obj.event === 'detail') {
                top.layer.prompt({
                    formType: 2, title: '请填写意见',
                    value: ''
                }, function (value, childIndex) {
                    if (value == null || value == '') {
                        top.layer.msg('请填写意见！');
                        return false;
                    }
                    data.replyTxt = value;
                    data.ifAddAdviseBank = false;
                    configureCom.postDataAjax(configure.EXPERT_ADD_UPDATE_SUGGEST_HTTP, data).then(function (res) {
                        top.layer.msg('保存成功！');
                        //top.layer.close(layer.index);
                        top.layer.close(childIndex);
                        configureCom.tableReload(true);
                    });
                });
                return false;
            }
        });
    });
</script>
</body>
</html>